< previous page page_351 next page >

Page 351
    Next
    '
    MsgBox strMsg, vbInformation, "Index"
    '
    ' clean up
    db.Close
    ws.Close
    Set pr = Nothing
    Set fl = Nothing
    Set ix = Nothing
    Set td = Nothing
    Set db = Nothing
    Set ws = Nothing
    '
    Exit Sub
    '
LocalErr:
    strMsg = strMsg & "<err>"
    Resume Next
    '
End Sub
The code in Listing 9.19 seems pretty familiar, right? After creating a database and adding a table (handled by cmdCreateTable), you build and add the index. Notice that you first name the index, and then create a Field object for the target index. By adding the Field object and setting some other properties, you have completed the index definition. Finally, you append the index to the collection of indexes for the specific table.
Tip.gif
Although you append indexes to a specific table object, the index name is global for the entire database. You cannot create an Index object called Index1 for Table1 and then create another Index1 for Table2. You must have unique index names.

Save and run the project. Click the Index button and check your results against those in Figure 9.18.
0351-01.jpg
Figure 9.18.
The results of adding an index.

 
< previous page page_351 next page >

If you like this book, buy it!